import sys
import os
from nuitka.__main__ import main as nuitka_main

# Set up the command-line arguments for Nuitka
sys.argv = [
    "nuitka",
    "--standalone",
    "--windows-icon-from-ico=logo.ico",
    "--include-data-dir=static=static",
    "--include-data-dir=templates=templates",
    # "--include-module=xlrd",
    "--include-distribution-metadata=jieba",
    "--include-distribution-metadata=Levenshtein",
    "--follow-import-to=xlrd",
    "--follow-import-to=pypinyin",
    "--enable-plugins=no-qt,matplotlib,transformers",
    "--output-dir=bin",
    "app.py"
]

# Add additional module directories to Python path
additional_paths = [
    '.',
    '../Layout Parser',
    '../LLM_APIs/Spark_API',
    '../LLM_APIs/Qwen_API',
    '../LLM_APIs/GPT_API',
    '../LLM_APIs/Local_API',
    '../finetune encoder'
]

for path in additional_paths:
    sys.path.append(os.path.abspath(path))

# Run Nuitka
if __name__ == "__main__":
    nuitka_main()
